<%--
  Created by IntelliJ IDEA.
  User: zhangdeng
  Date: 2020/12/02
  Time: 10:51
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" pageEncoding="UTF-8" %>
<%@ page import="com.sjsq.po.Book" %>
<%@ page import="com.sjsq.po.User" %>

<%
    // 获取绝对路径路径 ,开发项目一定要使用绝对路径，不然肯定出错
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":"
            + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <base href="<%=basePath %>" />
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>图书详情</title>
    <style type="text/css">
        h1{
            text-align: center;
        }
        a{
            text-align:center;font-size: 24px;text-decoration: none;
        }
        a:hover{
            text-decoration: underline;font-size: 20px;
        }
        #before{
            text-align: center;
        }
        #head{
            background: #eeeeee;height: 80px;
        }
        #headLink{
            font-size: 20px;
        }
        #headWelLink{
            font-size: 20px;
        }
    </style>
</head>
<body>
    <%--头部信息--%>
    <%
        User user =(User)session.getAttribute("user");
        if(user == null){
            response.sendRedirect("login.jsp");
        }else {
    %>
    <div id="head">
        <table width="100%">
            <td id="headWelLink">欢迎您：<%=user.getName()%></td>
            <td align="right" id="headLink">
                <a href="cart.jsp">我的购物车</a>
                <a href="logout.jsp">安全退出</a>
            </td>
        </table>
    </div>
    <%
        }
    %>


    <h1>图书详情</h1>
    <div id="before">
        <a href="javascript: window.history.go(-1)">返回上一级</a>
    </div>
    <%
        Book book = (Book)session.getAttribute("book");
    %>
    <table align="center" cellpadding="20" cellspacing="20">
        <tr style="font-size: 20px">
            <td>图书编号</td>
            <td>图书名称</td>
            <td>图书价格</td>
            <td>图书作者</td>
            <td>图书封皮</td>
            <td>图书出版社</td>
        </tr>
        <tr>
            <td><%=book.getBookid()%></td>
            <td><%=book.getBookname()%></td>
            <td><%=book.getPrice()%></td>
            <td><%=book.getAuthor()%></td>
            <td><%=book.getPicture()%></td>
            <td><%=book.getPublish()%></td>
        </tr>
        <tr>
            <td colspan="3"></td>
            <td></td>
            <td colspan="2"></td>
        </tr>
    </table>
    <div style="text-align:center;font-size: 36px;">
        <a href="doCart.jsp">添加到购物车</a>
        <a href="book.jsp">图书列表</a>
    </div>
</body>
</html>
